home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C20 / FEditTest.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  658 b   |  28 lines

  1. //: C20:FEditTest.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. //{L} FileEditor
  7. // Test the FileEditor tool
  8. #include "FileEditor.h"
  9. #include "../require.h"
  10. #include <sstream>
  11. using namespace std;
  12.  
  13. int main(int argc, char* argv[]) {
  14.   requireArgs(argc, 1);
  15.   FileEditor file(argv[1]);
  16.   // Do something to the lines...
  17.   int i = 1;
  18.   FileEditor::iterator w = file.begin();
  19.   while(w != file.end()) {
  20.     ostringstream ss;
  21.     ss << i++;
  22.     *w = ss.str() + ": " + *w;
  23.     w++;
  24.   }
  25.   // Now send them to cout:
  26.   file.write();
  27. } ///:~
  28.